<{include file=$module.'/header.php'}>
<div class="page getcash">
	<header class="bar bar-nav common-bar-nav">
		<a class="icon pull-left fa fa-arrow-left back"></a>
		<h1 class="title">升级VIP</h1>
		<!-- <a class="pull-right external" href="/<{$routeUrl}>/cash_log?tab=1">提现记录</a> -->
	</header>
	<{include file=$module.'/nav.php'}>
	<div class="content">
		<div class="takeout-title">
			账户余额：<span><{$admin.money}> 元 </span>
		</div>
		<ul class="takeout-list">
			<li>
				<div class="takeout-item-left">升级VIP</div>
				<div class="takeout-item-right">
					<p class="takeout-rule">当前到期时间: <{$admin.vip_time}></p>
					<p class="takeout-rule">升级VIP价格为 100 元，增加有效期 90 天</p>
					<{if $admin.money < 100}>
						<a href="#" class="button button-big button-fill button-success disabled">不足 100 元</a>
					<{else}>
						<a href="#" class="button button-big button-fill button-danger">升级</a>
					<{/if}>
				</div>
			</li>

			
		</ul>
	</div>
</div>

<script>
$(function(){
	$('.button-danger').click(function(){
		var $this = $(this);
		if($this.hasClass('disabled')) {
			return false;
		}
		var account = <{$admin.money}>;
		// var fee = parseFloat($.trim($('#fee').val()));
		var fee = 100;
		// if(isNaN(fee)) {
		// 	$.toast('余额提现有误');
		// 	return false;
		// }
		// if(fee > account) {
		// 	$.toast('提现余额大于账户可用余额');
		// 	return false;
		// }
		if(fee < 100) {
			$.toast('提现余额不能小于 100 元');
			return false;
		}
		// var rule_fee = (fee * 5 / 100).toFixed(2);
		// rule_fee = Math.max(rule_fee, account.fee_min);
		// rule_fee = Math.min(rule_fee, account.fee_max);
		// rule_fee = parseFloat(rule_fee);
		// var final_fee = (fee / 100).toFixed(2);
		// var final_fee = (fee - rule_fee).toFixed(2);
		var tips = "确定发费 " + fee + " 元, 升级VIP会员吗";
		$.confirm(tips, function(){
			// if(final_fee <= 0) {
			// 	$.toast('实际到账金额小于0元, 不能进行提现');
			// 	return false;
			// }
			$this.addClass('disabled');
			$.post("/<{$routeUrl}>/<{$action}>", {do:'vip',fee: fee}, function(response){
				// var result = $.parseJSON(data);
				if(response.code == 0) {
					$.toast(response.msg, response.url);
					$this.removeClass('disabled');
				} else {
					$.toast('升级成功', "/<{$routeUrl}>/vip");
				}
				return false;
			});
		});
	});
});
</script>

<{include file=$module.'/footer.php'}>